<?php
namespace Common\Model;
use Common\Common\Object;

/**
 * Class CustomerObject
 * @package Common\Model
 *
 * @property string $ID
 * @property string $Username
 * @property string $Password
 * @property string $Nickname
 * @property string $Address
 *
 */
class CustomerObject extends Object{

    /**
     * 获取我的所有收藏
     * @return array
     */
    public function fetchCollects(){
        /** @var CollectModel $collect */
        $collect = D('Collect');
        return $collect->fetchList(['Customer'=>$this->ID]);
    }

    /**
     * 校验密码是否正确
     * @param $value
     * @return bool
     */
    public function checkPassword($value){
        return $value == $this->data['password'];
    }

    /**
     * 统计购物车商品数量
     */
    public function countCats(){
        return 10;
    }

}